package com.zdp.chat.entity;


import com.zdp.chat.entity.resp.WSBaseResp;
import com.zdp.chat.enums.WSRespTypeEnum;
import org.springframework.stereotype.Component;


/**
 * socket信息建造者
 *
 * @author hf
 */
@Component
public class WSBuilder {

    public static final String  SYSTEM_FRIEND_APPLY = "对方接受了你的好友申请，快来聊天吧！";

/*    *//**
     * 登录成功实体
     *
     * @return 用户信息
     *//*
    public static WSBaseResp<UserInfoDTO> buildLoginSuccessResp(UserInfoDTO userInfo) {
        WSBaseResp<UserInfoDTO> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.LOGIN_SUCCESS.getType());
        wsBaseResp.setData(userInfo);
        return wsBaseResp;
    }*/

    public static WSBaseResp<String> buildResp(WSRespTypeEnum typeEnum) {
        WSBaseResp<String> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(typeEnum.getType());
        wsBaseResp.setData(typeEnum.getDesc());
        return wsBaseResp;
    }

/*    *//**
     * 登录失败实体
     *
     * @return 实体
     *//*
    public static WSBaseResp<WSLoginSuccess> buildInvalidateTokenResp() {
        WSBaseResp<WSLoginSuccess> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.INVALIDATE_TOKEN.getType());
        return wsBaseResp;
    }

    public static WSBaseResp<ChatMessageResp> buildMsgSend(ChatMessageResp msgResp) {
        WSBaseResp<ChatMessageResp> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.MESSAGE.getType());
        wsBaseResp.setData(msgResp);
        return wsBaseResp;
    }

    public static WSBaseResp<RoomBaseInfoBO> buildRoomInfo(RoomBaseInfoBO msgResp) {
        WSBaseResp<RoomBaseInfoBO> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.ROOM_INFO.getType());
        wsBaseResp.setData(msgResp);
        return wsBaseResp;
    }

    public static WSBaseResp<String> buildSystemMsg(String content) {
        WSBaseResp<String> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.SYSTEM.getType());
        wsBaseResp.setData(content);
        return wsBaseResp;
    }

    public static WSBaseResp<ChatRoomListResp> buildApplyMsg(ChatRoomListResp resp) {
        WSBaseResp<ChatRoomListResp> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.SYSTEM.getType());
        resp.setBody(SYSTEM_FRIEND_APPLY);
        wsBaseResp.setData(resp);
        return wsBaseResp;
    }*/
}
